package windows;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.JTextField;


public class ManageInsumosModify extends JPanel implements ActionListener
{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private JButton btnSaveChanges;
	private JButton btnSearch;
	private JButton btnDelete;
	private JButton btnModifyAmount;
	private JButton btnAddInsumos;


	private JList  lstEditFields;

	private JComboBox cboNamesInsumos;

	private JLabel lblNameInsumo;
	private JLabel lblCodInsumo;
	private JLabel lblListInsumos;

	private JTextField txtAreaNameInsumo;
	private JTextField txtAreaCodInsumo;

	private JSpinner spnAmount;

	private JSeparator Separator;
	private JSeparator SeparatorHalf;
	private JSeparator SeparatorEnd;



	public ManageInsumosModify()
	{
		// TODO Auto-generated constructor stub

	setLayout(null);


	/***************************JButton**************************************/
	btnSaveChanges = new JButton("Guardar Cambios");
	btnSaveChanges.setBounds(145, 350, 150, 20);
	btnSaveChanges.setVisible(false);
	btnSaveChanges.addActionListener(this);
	add(btnSaveChanges);

	btnSearch= new JButton("Buscar");
	btnSearch.setBounds(370,15, 80, 20);
	btnSearch.addActionListener(this);
	add(btnSearch);


	btnDelete= new JButton("Eliminar de la Lista");
	btnDelete.setBounds(240,130, 150, 20);
	btnDelete.setVisible(false);
	btnDelete.addActionListener(this);
	add(btnDelete);

	btnModifyAmount= new JButton("Modificar Cantidad");
	btnModifyAmount.setBounds(240,160, 150, 20);
	btnModifyAmount.setVisible(false);
	btnModifyAmount.addActionListener(this);

	add(btnModifyAmount);

	btnAddInsumos= new JButton("Agregar Insumos");
	btnAddInsumos.setBounds(240,190, 150, 20);
	btnAddInsumos.setVisible(false);
	btnAddInsumos.addActionListener(this);
	add(btnAddInsumos);

	btnAddInsumos= new JButton(" Agregar Insumo ");
	btnAddInsumos.setBounds(145, 290, 150, 20);
	btnAddInsumos.setVisible(false);
	btnAddInsumos.addActionListener(this);
	add(btnAddInsumos);


    /******************************JLabel**********************************/

	lblCodInsumo=new JLabel("Codigo:");
	lblCodInsumo.setBounds(50, 15, 150, 25);
	add(lblCodInsumo);

	lblNameInsumo = new JLabel("Nombre Lista:");
	lblNameInsumo.setBounds(50, 50, 150, 25);
	add(lblNameInsumo);

	lblListInsumos = new JLabel("Lista de Insumos:");
	lblListInsumos.setBounds(50, 100, 150, 25);
	add(lblListInsumos);


	cboNamesInsumos= new JComboBox();
	cboNamesInsumos.setBounds(80,250,150,25);
	add(cboNamesInsumos);

	cboNamesInsumos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Harina", "Leche", "Azucar", "Huevos" , "Colorantes", "Saborizantes", "Fresas", "Uvas Pasas"}));

	/****************************JTextField*************************************/

	txtAreaNameInsumo = new JTextField();
	txtAreaNameInsumo.setBounds(180, 50, 150, 20);
	txtAreaNameInsumo.setEnabled(false);
	add(txtAreaNameInsumo);

	txtAreaCodInsumo = new JTextField();
	txtAreaCodInsumo.setBounds(180, 15, 150, 20);
	add(txtAreaCodInsumo);

	/****************************** JList *************************/
	 lstEditFields = new JList();
	 lstEditFields.setBounds(80, 130, 150, 90);
	 lstEditFields.setVisible(true);
	 add(lstEditFields);

	 /****************************************/


	spnAmount=new JSpinner();
	spnAmount.setBounds(280, 250, 40, 25);
	spnAmount.setEnabled(false);
	add(spnAmount);

	Separator =new JSeparator();
	Separator.setBounds(50, 100, 360,5 );
	add(Separator);


	SeparatorHalf =new JSeparator();
	SeparatorHalf.setBounds(50, 240, 360,5 );
	add(SeparatorHalf);

	SeparatorEnd =new JSeparator();
	SeparatorEnd.setBounds(50, 330, 360,5 );
	add(SeparatorEnd);

	/************************************/


	/*Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	setBounds((screenSize.width-664)/2, (screenSize.height-456)/2, 670, 310);*/
}



	public void actionPerformed(ActionEvent e)
	{

		if(e.getSource()==btnSearch)
		{
			btnDelete.setVisible(true);
			btnAddInsumos.setVisible(true);
			btnAddInsumos.setVisible(false);

		}
		if(e.getSource()==btnSaveChanges)
		{


			//txtAreaNameInsumo.setEnabled(true)
		}
		/*if(e.getSource()==btnSave)
		{

		}*/
	}

	public void pushFocus()
	{
		//txtSearch.grabFocus();
	}
}
